package com.sgb.kjwl.view.ui.activity.transport;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;

import androidx.core.util.Pair;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.sgb.capital.view.ui.activity.OpenAccountFirstActivity;
import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityInquiryDetailsBinding;
import com.sgb.kjwl.model.entity.transport.AgreedCarOfferEntity;
import com.sgb.kjwl.model.entity.transport.GoodsSourcePlace;
import com.sgb.kjwl.model.entity.transport.TransportOrderEntity;
import com.sgb.kjwl.model.entity.transport.common.AddressItem;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.CargoConstant;
import com.sgb.kjwl.utils.EntityConversion;
import com.sgb.kjwl.utils.NumberUtil;
import com.swgk.core.util.UserOperating;
import com.sgb.kjwl.view.constant.RouterKey;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.LogisticsEvent;
import com.sgb.kjwl.view.ui.activity.self.order.OrderRequireInfoActivity;
import com.sgb.kjwl.view.ui.activity.self.userInfo.VerificationCodeLoginActivity;
import com.sgb.kjwl.view.ui.activity.transport.owner.TransportOrderDetailOwnerActivity;
import com.sgb.kjwl.view.ui.activity.vehicleManagement.VehicleDetailActivity;
import com.sgb.kjwl.view.ui.adapter.transport.GoodsDetailAddressAdapter;
import com.swgk.core.dialog.RoundDialog;
import com.sgb.kjwl.viewmodel.transport.InquiryDetailModel;
import com.swgk.core.customview.ItemInputTextView;
import com.swgk.core.util.DateUtils;
import com.swgk.core.util.SharedPreferenceUtil;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @Author : 熊丽
 * @date :2021/4/9 0009$ 11:43$
 * @Description ://询价详情$
 */
public class InquiryDetailActivity extends AppActivity implements GoodsDetailAddressAdapter.ItemOnClickListen, ItemInputTextView.OnWholeItemClickListener, View.OnClickListener {
    private ActivityInquiryDetailsBinding mBinding;
    private GoodsDetailAddressAdapter mAdapter;
    private OperateEnquiryDetail operateEnquiryDetail;
    private Timer timer;
    TransportOrderEntity mEntity;
    boolean isGoodsOwner;//是否是货主   1是货主  0是车主
    String carrierNo;
    InquiryDetailModel mModel;

    public static void start(Context context, boolean isOwnerList, String carrierNo) {
        Intent intent = new Intent(context, InquiryDetailActivity.class);
        Bundle bundle = new Bundle();
        bundle.putBoolean(RouterKey.BOOLEAN, isOwnerList);
        bundle.putString("carrierNo", carrierNo);
        intent.putExtras(bundle);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }

    @Override
    protected void initView() {
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }
        isGoodsOwner = getIntent().getExtras().getBoolean(RouterKey.BOOLEAN);
        carrierNo = getIntent().getExtras().getString("carrierNo");
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_inquiry_details);
        mModel = new ViewModelProvider(this).get(InquiryDetailModel.class);
        mBinding.inquiryBarTitle.titleView.setText("询价详情");
        mModel.getOperateMyInquiryDetails(this, carrierNo, isGoodsOwner);
        initEvent();

    }

    private void initEvent() {
        mBinding.inquiryBarTitle.ivBack.setOnClickListener(this::onClick);
        mBinding.itvRequirement.setOnWholeItemClickListener(this);
        mBinding.itvPaymentAppointment.setOnWholeItemClickListener(this);
        mBinding.tvCommit.setOnClickListener(this::onClick);
        mBinding.viewDetails.setOnClickListener(this::onClick);
        mBinding.tvContactService.setOnClickListener(this::onClick);
        mBinding.tvContactBohao.setOnClickListener(this::onClick);
        mBinding.orderDetails.setOnClickListener(this::OnWholeItemClick);
        mModel.OperateEnquiryDetail.observe(this, operateEnquiryDetail1 -> {
            setDetail(operateEnquiryDetail1);
        });
        mModel.AgreedCarOfferEntityData.observe(this, agreedCarOfferEntity -> {
            InquirySuccess(agreedCarOfferEntity);
        });

    }

    private void setAddressInfo(GoodsSourcePlace goodsSourceDetail, String handleTypeNo) {
        List<AddressItem> items = new ArrayList<>();
        if (goodsSourceDetail != null) {
            initSettingItem(items, goodsSourceDetail, handleTypeNo);
            mAdapter = new GoodsDetailAddressAdapter(items, goodsSourceDetail);
            mAdapter.SetItemOnClickListen(this);
            mBinding.recyclerViewContent.setLayoutManager(new LinearLayoutManager(this));
            mBinding.recyclerViewContent.setAdapter(mAdapter);
        }

    }

    /**
     * 初始化功能列表
     */
    public void initSettingItem(List<AddressItem> list, GoodsSourcePlace mgoodsSourcePkace, String handleTypeNo) {
        if (list == null) return;
        list.clear();
        if ("11".equals(handleTypeNo)) {//一装一卸
            list.add(new AddressItem(mgoodsSourcePkace.getProvinceName() + "  " + mgoodsSourcePkace.getCityName() + "  " + mgoodsSourcePkace.getDistrictName(), mgoodsSourcePkace.getDetailAddress(), mgoodsSourcePkace.getFirstDistance(), true, R.mipmap.icon_load_goods, handleTypeNo, 0));
            list.add(new AddressItem(mgoodsSourcePkace.getDestProvinceName() + "  " + mgoodsSourcePkace.getDestCityName() + "  " + mgoodsSourcePkace.getDestDistrictName(), mgoodsSourcePkace.getDestDetailAddress(), null, false, R.mipmap.icon_unload_goods, handleTypeNo, 1));
        } else if ("12".equals(handleTypeNo)) {//一装两卸
            list.add(new AddressItem(mgoodsSourcePkace.getProvinceName() + "  " + mgoodsSourcePkace.getCityName() + "  " + mgoodsSourcePkace.getDistrictName(), mgoodsSourcePkace.getDetailAddress(), mgoodsSourcePkace.getFirstDistance(), true, R.mipmap.icon_load_goods, handleTypeNo, 0));
            list.add(new AddressItem(mgoodsSourcePkace.getViaDestProvinceName() + "  " + mgoodsSourcePkace.getViaDestCityName() + "  " + mgoodsSourcePkace.getViaDestDistrictName(), mgoodsSourcePkace.getViaDestDetailAddress(), mgoodsSourcePkace.getSecondDistance(), true, R.mipmap.icon_unload_one, handleTypeNo, 1));
            list.add(new AddressItem(mgoodsSourcePkace.getDestProvinceName() + "  " + mgoodsSourcePkace.getDestCityName() + "  " + mgoodsSourcePkace.getDestDistrictName(), mgoodsSourcePkace.getDestDetailAddress(), null, false, R.mipmap.icon_unload_two, handleTypeNo, 2));
        } else if ("21".equals(handleTypeNo)) {//两装一卸
            list.add(new AddressItem(mgoodsSourcePkace.getProvinceName() + "  " + mgoodsSourcePkace.getCityName() + "  " + mgoodsSourcePkace.getDistrictName(), mgoodsSourcePkace.getDetailAddress(), mgoodsSourcePkace.getFirstDistance(), true, R.mipmap.icon_load_one, handleTypeNo, 0));
            list.add(new AddressItem(mgoodsSourcePkace.getViaSendProvinceName() + "  " + mgoodsSourcePkace.getViaSendCityName() + "  " + mgoodsSourcePkace.getViaSendDistrictName(), mgoodsSourcePkace.getViaSendDetailAddress(), mgoodsSourcePkace.getSecondDistance(), true, R.mipmap.icon_load_two, handleTypeNo, 1));
            list.add(new AddressItem(mgoodsSourcePkace.getDestProvinceName() + "  " + mgoodsSourcePkace.getDestCityName() + "  " + mgoodsSourcePkace.getDestDistrictName(), mgoodsSourcePkace.getDestDetailAddress(), null, false, R.mipmap.icon_unload_goods, handleTypeNo, 2));
        } else if ("22".equals(handleTypeNo)) {
            list.add(new AddressItem(mgoodsSourcePkace.getProvinceName() + "  " + mgoodsSourcePkace.getCityName() + "  " + mgoodsSourcePkace.getDistrictName(), mgoodsSourcePkace.getDetailAddress(), mgoodsSourcePkace.getFirstDistance(), true, R.mipmap.icon_load_one, handleTypeNo, 0));
            list.add(new AddressItem(mgoodsSourcePkace.getViaSendProvinceName() + "  " + mgoodsSourcePkace.getViaSendCityName() + "  " + mgoodsSourcePkace.getViaSendDistrictName(), mgoodsSourcePkace.getViaSendDetailAddress(), mgoodsSourcePkace.getSecondDistance(), true, R.mipmap.icon_load_two, handleTypeNo, 1));
            list.add(new AddressItem(mgoodsSourcePkace.getViaDestProvinceName() + "  " + mgoodsSourcePkace.getViaDestCityName() + "  " + mgoodsSourcePkace.getViaDestDistrictName(), mgoodsSourcePkace.getViaDestDetailAddress(), mgoodsSourcePkace.getThirdDistance(), true, R.mipmap.icon_unload_one, handleTypeNo, 2));
            list.add(new AddressItem(mgoodsSourcePkace.getDestProvinceName() + "  " + mgoodsSourcePkace.getDestCityName() + "  " + mgoodsSourcePkace.getDestDistrictName(), mgoodsSourcePkace.getDestDetailAddress(), null, false, R.mipmap.icon_unload_two, handleTypeNo, 3));
        }
    }

    public void setDetail(OperateEnquiryDetail operateEnquiryDetail) {
        mBinding.inquiryContent.setVisibility(View.VISIBLE);
        mBinding.setViewMode(operateEnquiryDetail);
        this.operateEnquiryDetail = operateEnquiryDetail;
        mBinding.inquiryLoadTimeText.setText(CargoConstant.stampFormatListLoadTime(true,NumberUtil.convertToLong(operateEnquiryDetail.getShipmentTime()), operateEnquiryDetail.getStartPointTime(),NumberUtil.convertToLong(operateEnquiryDetail.getShipmentEndTime()), operateEnquiryDetail.getEndPointTime()));
        mEntity = EntityConversion.modelA2B(operateEnquiryDetail, TransportOrderEntity.class);
        setAddressInfo(operateEnquiryDetail.getPlace(), operateEnquiryDetail.getHandleTypeNo());
        setState(operateEnquiryDetail);
        setComPanyInfo(operateEnquiryDetail);
        if (!isGoodsOwner){
            mBinding.inquiryCarInfo.setVisibility(View.GONE);
        }else {
            if (operateEnquiryDetail.getInquiryObject()!=null &&!"3".equals(operateEnquiryDetail.getInquiryObject())){
                mBinding.inquiryCarInfo.setVisibility(View.GONE);
            }
        }
        if (!TextUtils.isEmpty(operateEnquiryDetail.getCarrierNo())) {
            mBinding.inquiryCarMessage.setText("询价承运");
            mBinding.inquiryCarMessageText.setText(operateEnquiryDetail.getCityName() + " " + operateEnquiryDetail.getDistrictName() + "->" + operateEnquiryDetail.getDestCityName() + " " + operateEnquiryDetail.getDestDistrictName());
        } else {
            mBinding.inquiryCarMessage.setText("询价车辆");
            mBinding.inquiryCarMessageText.setText(operateEnquiryDetail.getCarNumber()+"/"+operateEnquiryDetail.getInquiryCarTypeName()+"/"+operateEnquiryDetail.getInquiryCarLenName()+"/"+ NumberUtil.trim0(operateEnquiryDetail.getInquiryWeight())+"吨");
        }
    }

    @Override
    public void onItemClick(GoodsSourcePlace place, String i, int position) {
        if (operateEnquiryDetail == null) return;
        String company = operateEnquiryDetail.getCompanyName();
        //TODO 去地图查看界面
        switch (i) {
            case "11":
                HandleAdressActivity.start(this, operateEnquiryDetail.getContrcts(), company, operateEnquiryDetail.getContrctsNumber(), operateEnquiryDetail.getImAccount(), operateEnquiryDetail.getPlace(), position, "11");
                break;
            case "12":
                HandleAdressActivity.start(this, operateEnquiryDetail.getContrcts(), company, operateEnquiryDetail.getContrctsNumber(), operateEnquiryDetail.getImAccount(), operateEnquiryDetail.getPlace(), position, "12");
                break;
            case "21":
                HandleAdressActivity.start(this, operateEnquiryDetail.getContrcts(), company, operateEnquiryDetail.getContrctsNumber(), operateEnquiryDetail.getImAccount(), operateEnquiryDetail.getPlace(), position, "21");
                break;
            case "22":
                HandleAdressActivity.start(this, operateEnquiryDetail.getContrcts(), company, operateEnquiryDetail.getContrctsNumber(), operateEnquiryDetail.getImAccount(), operateEnquiryDetail.getPlace(), position, "22");
                break;
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(LogisticsEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_REFRESH_OWNER_INQUIRY) {
            finish();
        }
    }

    private void setComPanyInfo(OperateEnquiryDetail operateEnquiryDetail) {
        mBinding.companyName.setText(isGoodsOwner ?operateEnquiryDetail.getCompanyName() : operateEnquiryDetail.getCompanyName());
       // mBinding.enterprisePhoneNumber.setText(operateEnquiryDetail.getTelphone());
            mBinding.enterpriseContact.setText(operateEnquiryDetail.getInquiryContact());
            mBinding.enterpriseContactName.setText(operateEnquiryDetail.getTelphone());
        RequestOptions options = new RequestOptions()
                .dontAnimate()
                .placeholder( "3".equals(operateEnquiryDetail.getInquiryObject()) ? R.drawable.geren_person_touxiang : "1".equals(operateEnquiryDetail.getInquiryObject()) ? R.mipmap.goods_list_company_icon : R.drawable.goods_detail_touxiang)
                .error( "3".equals(operateEnquiryDetail.getInquiryObject()) ? R.drawable.geren_person_touxiang : "1".equals(operateEnquiryDetail.getInquiryObject()) ? R.mipmap.goods_list_company_icon : R.drawable.goods_detail_touxiang)
                .centerCrop();
        if (!isDestroyed()) {
            Glide.with(this).load(operateEnquiryDetail.getLogo()).apply(options).into(mBinding.imgLogo);
        }

    }

    private void setState(OperateEnquiryDetail operateEnquiryDetail) {
        mBinding.countdownTimeText.setText("询价时间    "+DateUtils.stampToDay6(operateEnquiryDetail.getCreateTime()));
        mBinding.llTvCommit.setVisibility(isGoodsOwner ? View.GONE : operateEnquiryDetail.getOfferStatus() == 1 || operateEnquiryDetail.getOfferStatus() == 2 ? View.VISIBLE : View.GONE);
        switch (operateEnquiryDetail.getOfferStatus()) {
            case 1:
                mBinding.rlTimeCountdown.setVisibility(View.VISIBLE);
                if (isGoodsOwner){
                    mBinding.managerStatus.setText("询价待确认");
                }else {
                    mBinding.managerStatus.setText("待确认");
                }
                mBinding.rlGoodsStatus.setBackgroundResource(R.drawable.goods_detail_status_jingjiazhong);
                if (timer == null) {
                    timer = new Timer();
                }
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        if (operateEnquiryDetail != null && !TextUtils.isEmpty(operateEnquiryDetail.getShipmentEndTime())) {
                            runOnUiThread(() -> mBinding.quotationTime.setText("确认倒计时 "
                                    + DateUtils.dateDiff(DateUtils.stampToDay6("" + operateEnquiryDetail.getShipmentEndTime())) + (isGoodsOwner ? "超时车主将无法确认本次询价，建议您尽快联系车主" : "超时您将无法确认本次询价，建议您尽快联系货主")));
                        }
                    }
                }, 0, 1000);
                if (UserOperating.getInstance().getUserIdentity() == 1 || UserOperating.getInstance().getUserIdentity() == 2) {
                    mBinding.llTvCommit.setVisibility(View.GONE);
                }else{
                    mBinding.tvCommit.setText("同意询价");
                }
                break;
            case 2:
                mBinding.rlGoodsStatus.setBackgroundResource(R.drawable.goods_detail_status_chengjiao);
                mBinding.orderDetailsNo.setText("运输订单：" + operateEnquiryDetail.getOrderNo());
                mBinding.orderDetails.setVisibility(View.VISIBLE);
                mBinding.tvCommit.setText("查看运输订单");
                if (isGoodsOwner) {
                    mBinding.managerStatus.setText("同意询价");
                }else {
                    mBinding.managerStatus.setText("已同意");
                    mBinding.orderGo.setVisibility(View.GONE);
                }
                break;
            case 3:
                mBinding.rlGoodsStatus.setBackgroundResource(R.drawable.goods_detail_status_jieshu);
                mBinding.viewLine10.setVisibility(View.VISIBLE);
                mBinding.managerStatus.setText("超时未确认");

                break;
            case 4:
                mBinding.viewLine10.setVisibility(View.VISIBLE);
                mBinding.managerStatus.setText("已过期");
                mBinding.rlGoodsStatus.setBackgroundResource(R.drawable.goods_detail_status_jieshu);
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (timer != null) {
            timer = null;
        }
        EventBus.getDefault().unregister(this);
    }

    @Override
    public void OnWholeItemClick(View view) {
        switch (view.getId()) {
            case R.id.itv_requirement:
                if (null != mEntity)
                    OrderRequireInfoActivity.start(this, mEntity, isGoodsOwner);
                break;
            case R.id.itv_payment_appointment:
                if (null != mEntity)
                    TransportInvoiceInfoActivity.start(this, mEntity);
                break;
            case R.id.order_details:
                ActivityJump.jumpToActivity(this, TransportOrderDetailOwnerActivity.class, Pair.create("no", operateEnquiryDetail.getOrderNo()),
                        Pair.create("isGoodsOwner", TransportOrderDetailOwnerActivity.CAR_OWNER));
                break;
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_commit:
                if ("同意询价".equals(mBinding.tvCommit.getText())) {
                    if (!UserOperating.getInstance().getUserInfo().isDriverOpenFundsAccount()) {
                        new RoundDialog.Builder(this)
                                .title("提示")
                                .content("开通在线收款账户可同意货主询价，支付信息费")
                                .cancel("知道了")
                                .confirm("前往开户")
                                .contentGravity(Gravity.CENTER)
                                .cancelable(false)
                                .confirmCallback(thisv -> {
                                    OpenAccountFirstActivity.start(this, true);
                                })
                                .show();
                        return;
                    }
                    mModel.GetagreedCarOffer(this, operateEnquiryDetail.getGoodsSourceNo(), operateEnquiryDetail.getDriverAuthNo(), operateEnquiryDetail);

                } else if ("查看运输订单".equals(mBinding.tvCommit.getText())) {
                    ActivityJump.jumpToActivity(this, TransportOrderDetailOwnerActivity.class, Pair.create("no", operateEnquiryDetail.getOrderNo()),
                            Pair.create("isGoodsOwner", TransportOrderDetailOwnerActivity.CAR_OWNER));
                }
                break;
            case R.id.iv_back:
                finish();
                break;
            case R.id.view_details:
                if (operateEnquiryDetail == null) return;
                if (TextUtils.isEmpty(operateEnquiryDetail.getCarrierNo())) {
                    VehicleDetailActivity.start(this, operateEnquiryDetail.getDriverAuthNo());
                } else {
                    CarriageDetailActivity.start(this, operateEnquiryDetail.getCarrierNo(), 2);
                }
                break;
            case R.id.tv_contact_service:
                if (!isLogin()) {
                    VerificationCodeLoginActivity.start(InquiryDetailActivity.this);
                    return;
                }
                if (!contactsIsInSystem()) {
                    return;
                }
                if (operateEnquiryDetail != null && !TextUtils.isEmpty(operateEnquiryDetail.getImAccount())) {
                    // TODO IM功能目前需要全部去掉，此处需要后期IM迁移完成后完善
                   buildSingleTalking(operateEnquiryDetail.getImAccount());
                }
                break;
            case R.id.tv_contact_bohao:
                showTelDialog(operateEnquiryDetail.getTelphone());
                break;
        }
    }

    public void InquirySuccess(AgreedCarOfferEntity macoff) {
        getGoodsOwnerInfo(macoff, operateEnquiryDetail);

    }

    private void showTelDialog(String phone) {
        new RoundDialog.Builder(this)
                .title("确认拨号")
                .content(phone)
                .confirm("拨打")
                .cancel("取消")
                .confirmCallback(v -> {
                    Intent intent = new Intent(Intent.ACTION_DIAL);
                    Uri data = Uri.parse("tel:" + phone);
                    intent.setData(data);
                    startActivity(intent);
                })
                .show();
    }

    private boolean isLogin() {
        return !TextUtils.isEmpty(SharedPreferenceUtil.getInstance().
                getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""));
    }

    private boolean contactsIsInSystem() {
        if (operateEnquiryDetail == null) {
            return false;
        }
        return !TextUtils.isEmpty(operateEnquiryDetail.getImAccount());

    }

    //判断团队或企业是否开通资金账户
    public void getGoodsOwnerInfo(AgreedCarOfferEntity userAccount, OperateEnquiryDetail item) {
        if (item.getTerminal() == null) {
            return;
        }
        if (!userAccount.isDriverOpenFundsAccount() && item.getTerminal() == 2) {//货源货主团队没开通资金账户
            new RoundDialog.Builder(this)
                    .title("提示")
                    .content("同意询价需支付信息费，货主未开通收款账户，无法支付，请联系货主开通资金账户")
                    .singleBtn(true)
                    .confirm("确定")
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .show();
        } else if (!userAccount.isOpenFundsAccount() && item.getTerminal() == 1) {//货源货主企业没开通资金账户
            new RoundDialog.Builder(this)
                    .title("提示")
                    .content("同意询价需支付信息费，货主未开通收款账户，无法支付，请联系货主开通资金账户")
                    .singleBtn(true)
                    .confirm("确定")
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .show();
        } else if (!userAccount.isDriverOpenFundsAccount() && item.getTerminal() == 3) {//个人货源资金账户
            new RoundDialog.Builder(this)
                    .title("提示")
                    .content("同意询价需支付信息费，货主未开通收款账户，无法支付，请联系货主开通资金账户")
                    .singleBtn(true)
                    .confirm("确定")
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .show();
        } else {
            if ("1".equals(userAccount.getVehicleStatus())) {
                showConsignorDialog("货主询价车辆" + item.getCarNumber() + "已被下架，请至“用户中心 - 车辆管理”中重新提交认证");
            } else if ("2".equals(userAccount.getVehicleStatus())) {
                showConsignorDialog("货主询价车辆" + item.getCarNumber() + "已被系统删除，无法使用。更多问题，请联系客服：400-001-0051");
            } else if ("3".equals(userAccount.getVehicleStatus())) {
                PayGoodsOrderActivity.start(this, item.getGoodsSourceNo(), 1, item.getCarOfferNo());
            }
        }
    }

    public void showConsignorDialog(String message) {
        new RoundDialog.Builder(this)
                .title("车辆状态异常")
                .content(message)
                .cancel("确定")
                .contentGravity(Gravity.CENTER)
                .cancelable(false)
                .singleBtn(true)
                .show();
    }
}
